package com.cloudbroker.bcs.platform.ltb.middle.util;


import org.apache.commons.lang3.StringUtils;

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;

/**
 * Created by Administrator on 2016/1/14.
 */
public class StringUtil {

    public static String replaceStr(String str){
    	return str.replace("&lt;", "<").replace("&gt;", ">");
    }
    public static String replaceMobile(String str){
        if(StringUtils.isEmpty(str)){
            return str;
        }
        if(str.matches("^(1[34578]\\d{9})?$")){
            return str.replaceAll("(\\d{3})\\d{5}(\\d{3})", "$1****$2");
        }else {
            return str;
        }
    }


    public static String fomat(Number number, String pattern) {
        DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance();
        return new DecimalFormat(pattern, symbols).format(number);
    }


}
